interface StorageType{
    set(key:string,value:string):void,
    get(key:string):string,
    remove(key:string):void
}


class Storages implements StorageType {
    set(key:string,value:string){
        localStorage.setItem(key,JSON.stringify(value))
    }
    get(key:string){
        let token = localStorage.getItem(key) || null
        if(token){
            return JSON.parse(token)
        }
        return null

    }
    remove(key:string){
        localStorage.removeItem(key);
    }
}

let storage = new Storages();


export default storage